<template>
  <div class="main-content">
    <h2 style="margin-bottom:20px;">订单详情</h2>
    <el-card>
      <div>客户名称：{{ order.customer }}</div>
      <div>产品：{{ order.product }}</div>
      <div>交付状态：{{ order.status }}</div>
    </el-card>
    <h3 style="margin:20px 0 10px 0;">关联生产计划</h3>
    <el-table :data="planList" style="width: 100%;" border>
      <el-table-column prop="name" label="计划名称" align="center" />
      <el-table-column prop="status" label="状态" align="center" />
      <el-table-column prop="gongdan" label="工单" align="center" />
      <el-table-column prop="shebei" label="设备" align="center" />
      <el-table-column prop="yuangong" label="员工" align="center" />
      <el-table-column prop="remark" label="备注" align="center" />
    </el-table>
  </div>
</template>
<script>
import { getOrderById } from '@/utils/orderLocal';
import { getShengchanList } from '@/utils/shengchanLocal';
export default {
  data() {
    return {
      order: {},
      planList: [],
    };
  },
  created() {
    const id = this.$route.query.id;
    this.order = getOrderById(Number(id));
    // 假设生产计划的 gongdan 字段与订单 id 关联
    this.planList = getShengchanList().filter(i => i.gongdan == id);
  },
}
</script> 